{{extend '../layout.html'}}

{{block 'content'}}
<form class="main-table-add" id="user-form">
    <div class="form-group">
        <label for="exampleInputEmail1">姓名：</label>
        <input type="email" name="userName" class="form-control" placeholder="请输入用户名">
    </div>
    <div>
        <label>性别：</label>
    </div>
    <div class="form-check form-check-inline">
        <input class="form-check-input" type="radio" name="gender" id="inlineRadio1" value="1" checked>
        <label class="form-check-label" for="inlineRadio1">男</label>
        &nbsp; &nbsp; &nbsp;
        <input class="form-check-input" type="radio" name="gender" id="inlineRadio2" value="0">
        <label class="form-check-label" for="inlineRadio2">女</label>
    </div>
    <br><br>
    
    <div class="form-group">
        <label for="exampleInputPassword1">年龄：</label>
        <input type="number" name="age" class="form-control" placeholder="请输入年龄">
    </div>
    <div class="form-group">
        <label for="exampleInputPassword1">生日：</label>
        <input type="date" name="birthday" class="form-control" placeholder="请输入生日">
    </div>
    <div class="form-group">
        <label for="exampleInputPassword1">工作：</label>
        <input type="type" name="job" class="form-control"  placeholder="请输入职业">
    </div>
    <div class="form-group">
        <label for="exampleInputPassword1">描述：</label>
        <textarea class="form-control" name="describe" placeholder="简述"></textarea>
    </div>
    <button id="submit-userInfo" class="btn btn-primary">提交</button>
</form>

<script>
    $('#submit-userInfo').on('click', (event) => {
        event.preventDefault();

        let data = $('#user-form').serialize();

        $.post('/user/add', data, ({code}) => {
            if (!code) {
                window.location = '/'
            }
        })
    })
</script>
{{/block}}